package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.ILicaishiManagerUserDao;
import com.financing.platform.dto.LicaishiManagerUserDTO;
import com.financing.platform.util.SqlName;
import com.financing.platform.vo.LicaishiManagerUserVO;

@Repository("licaishiManagerUserDaoImpl")
public class LicaishiManagerUserDaoImpl extends BaseDaoImpl implements ILicaishiManagerUserDao {
	
	/**
	 * 添加理财师管理员
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int addLicaishiManagerUser(LicaishiManagerUserDTO user) throws SQLException{
		return (Integer)this.sqlMapClient.insert(SqlName.addLicaishiManagerUser,user);
	}
	
	/**
	 * 删除理财师管理员
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int deleteLicaishiManagerUser(LicaishiManagerUserVO user) throws SQLException{
		return this.sqlMapClient.delete(SqlName.deleteLicaishiManagerUser, user);
	}
	
	/**
	 * 查询所有的理财师管理员
	 * @return
	 * @throws SQLException
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<LicaishiManagerUserVO> queryLicaishiManagerUsers(LicaishiManagerUserVO user) throws SQLException{
		return this.sqlMapClient.queryForList(SqlName.queryLicaishiManagerUsers, user);
	}
	
	/**
	 * 查询所有理财师管理员的数量
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int queryLicaishiManagerUsersCount(LicaishiManagerUserVO user) throws SQLException{
		return (Integer)this.sqlMapClient.queryForObject(SqlName.queryCountOfLicaishiManagerUsers, user);
	}
	
	/**
	 * 查询还未添加的管理员
	 * @return
	 * @throws SQLException
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<LicaishiManagerUserVO> queryNotLicaishiManagerUsers(LicaishiManagerUserVO user) throws SQLException{
		return this.sqlMapClient.queryForList(SqlName.queryNotLicaishiManagerUsers, user);
	}
	
	/**
	 * 查询所有理财师管理员的数量
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int queryNotLicaishiManagerUsersCount(LicaishiManagerUserVO user) throws SQLException{
		return (Integer)this.sqlMapClient.queryForObject(SqlName.queryCountOfNotLicaishiManagerUsers, user);
	}
}
